/*
 * @Author: Naohand 120262455+Naohand@users.noreply.github.com
 * @Date: 2023-04-11 20:20:41
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2023-09-30 21:49:37
 * @FilePath: McuComm.h
 * @Description:
 */
#ifndef __MCUCOMM_H
#define __MCUCOMM_H

#include <mcu_pack/user_inc.h>
#include <mcu_pack/commSerial.hpp>



#define TEST_RT_TIME
// #define HIDCOM

#ifdef HIDCOM
#include "commUSB.hpp"
#endif

#ifdef UARTCOM
#include "commSerial.hpp"
#endif

#define MCU_COMMU_TX_LENGTH 50
#define MCU_COMMU_RX_LENGTH 25
#define RX_MCU_LENGTH 8
typedef struct
{
    float imudate[11];
    uint8_t flag[14];
} TxDate_t;
extern TxDate_t TxDate;

class MCU_Comm
{
public:

#ifdef HIDCOM
    commUSB *commusb;
#endif

#ifdef UARTCOM
    commSerial *commserial;
#endif

    explicit MCU_Comm(void);
    virtual ~MCU_Comm(void);
    // void WaitMcuPrepare(void);
    void Communicate2Mcu(char *data);
    void WriteUSBData(char *data);
    void ReadUSBData(char *data);
    void WaitForMcuPrepared(void);
    void Read2McuData();

protected:
private:
    char usb_tx_transdata[48] = {0};
    char usb_rx_transdata[MCU_COMMU_RX_LENGTH - 5] = {0};
};
extern int rx_mcu_flag;
extern MCU_Comm USB_uart;
void Embedded_Init();
#endif